﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mwc="clr-namespace:Mongoose.Windows.Controls">

    <Style TargetType="{x:Type mwc:Surface}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type mwc:Surface}">
                    <Grid>
                        <Thumb x:Name="PART_Thumb">
                            <Thumb.Template>
                                <ControlTemplate>
                                    <Grid Background="Transparent" />
                                </ControlTemplate>
                            </Thumb.Template>
                        </Thumb>
                        <Border BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" 
                                Background="{TemplateBinding Background}" 
                                Padding="{TemplateBinding Padding}" 
                                SnapsToDevicePixels="True">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Border>

                        <!-- This is a very tricky workaround to avoid "Airspace" issue when the content of a Pad is a win32 control host like WebBrowser
                         Having a control like textBlock that will refresh each time the pad is moved will ensure that the translation is correctly applied to these kind of controls-->
                        <TextBlock Text="{Binding MatrixTransform, RelativeSource={RelativeSource AncestorType={x:Type mwc:Surface}}}" Width="0" Height="0" Style="{x:Null}" FocusVisualStyle="{x:Null}"/>
                        
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas x:Name="SurfaceCanvas"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>